package com.ruoyi.sale.auditStatusMachine;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author
 * @Version 1.0
 */
@Component
public class ServiceFactory {

    private final Map<String, StatusService> content = new HashMap<>();

    @Autowired
    public ServiceFactory(List<StatusService> services) {
        for (StatusService service : services) {
            content.put(service.get(), service);
        }
    }

    public StatusService query(String flag) {
        return content.get(flag);
    }
}
